<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <div th:include="venue/common :: head"></div>
    <link rel="stylesheet" type="text/css" href="/static/lib/webuploader/0.1.5/webuploader.css">
    <!--<link rel="stylesheet" type="text/css" href="/static/css/venue/add-venue.css">-->
    <title>检票</title>
</head>
<body>
<div>
    <content class="page-container">
        <form class="form form-horizontal" id="form-show-add">
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>演出id：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="" placeholder="演出id" id="showId"
                           name="showId">
                </div>
            </div>

            <br/>

            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>会员id：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="" placeholder="会员id" id="memberId"
                           name="memberId">
                </div>
            </div>

            <br/>

            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>购买类型：</label>
                <div class="dropdown">
                    <select class="selectpicker" name="type" id="type">
                        <option value="不选座">不选座</option>
                        <option value="看台">看台</option>
                        <option value="内场">内场</option>
                        <option value="VIP">VIP</option>
                    </select>
                </div>
            </div>

            <br/>

            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>购买张数：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="" placeholder="购买张数" id="number"
                           name="number">
                </div>
            </div>

            <br/>

            <div class="row cl">
                <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-2">
                    <button type="button" class="btn btn-info reserveButton">
                        购买
                    </button>
                </div>
            </div>
        </form>
    </content>
</div>

<footer th:include="venue/common :: footer"></footer>

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/static/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="/static/lib/jquery.validation/1.14.0/jquery.validate.js"></script>
<script type="text/javascript" src="/static/lib/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="/static/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript" src="/static/lib/webuploader/0.1.5/webuploader.min.js"></script>

<!--/请在上方写此页面业务相关的脚本-->

<script th:inline="javascript">

    $('.reserveButton').on('click', function (e) {
        var showId = $("#showId").val();
        var memberId = $("#memberId").val();
        var type = $("#type").val();
        var number = $("#number").val();
        var inputs = {showId: showId, memberId: memberId, type: type, number: number};
        // console.log(inputs);
        $.ajax({
            type: "POST",
            url: '/venue/buy',
            data: inputs,
            dataType: 'json',
            success: function (data) {
                if (data.code == 200) {
                    alert("您的订单编号是： " + data.data.id +
                        "\n您的订单总价是： " + data.data.total +
                        "\n您的等级享受的折扣是： " + data.data.discount +
                        "\n您的应付金额是： " + data.data.total * data.data.discount);
                } else {
                    var error_msg = '<p class="errtip">	<strong>Error</strong>：' + data.reason + '</p>';
                    $(".err-msg").html(error_msg);
                }
            }
        });
    });

</script>

</body>
</html>